package com.markerhub.controller;


import com.markerhub.common.lang.Result;
import com.markerhub.entity.User;
import com.markerhub.service.UserService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zxc
 * @since 2021-06-11
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService  userService;

    /**
     * 简洁！方便！经过上面的步骤，基本上我们已经把mybatis plus框架集成到项目中了。
     * @return
     */

    @RequiresAuthentication
    @GetMapping("/index")
    public Result index(){
        User user = userService.getById(1l);
        return  Result.success(200,"成功获取",user) ;
    }

    @PostMapping("/save")
    public Result save(@Validated  @RequestBody User user) {

        return  Result.success(user) ;
    }


}
